#define _CRT_SECURE_NO_WARNINGS  1
#include<stdio.h>
int my_strlen(char arr[])
{
	int count = 0;
	while (*arr)
	{
		count++;
		arr++;
	}
	return count;
}

char* my_strcpy(char* arr, char* brr)
{
	char* p = arr;
	while (*brr)
	{
		(*arr) = (*brr);
		arr++;
		brr++;
	}
	return p;
}

int my_strcmp(char* arr, char* brr)
{
	while (*arr == *brr)
	{
		if (*arr == '\0')
			return 0;
		arr++;
		brr++;
	}
	if (*arr > *brr)
		return 1;
	else if (*arr < *brr)
		return -1;
}

char* my_strcat(char* arr, char* brr)
{
	char* p = arr;
	while (*p)
	{
		p++;
	}
	while (*p++ = *brr++)
	{
		;
	}
	return arr;
}

char* my_strstr(char* arr, char* brr)
{
	char* x = arr;
	char* y = brr;
	char* cur = arr;
	if (*brr == '\0')
		return NULL;

	while (*cur)
	{
		x = cur;
		y = brr;
		while (*x == *y && *x != '\0' && *y != '\0')
		{
			x++;
			y++;
		}
		if (*y == '\0')
		{
			return cur;
		}

		cur++;
	}
	return NULL;
}

int main()
{
	char arr[20] = "abcde";
	char brr[20] = "abcdf";
	printf("%d\n", my_strlen(arr)); // 5
	//char* p = my_strcpy(arr, brr);//qwert
	//printf("%s\n",p); 
	/*int ret=my_strcmp(arr, brr);
	if (ret > 0)
	{
		printf(">\n");
	}
	else if (ret == 0)
	{
		printf("=\n");
	}
	else
		printf("<\n");
	char*s=my_strcat(arr, brr);
	printf("%s\n", s);*/
	char* h = my_strstr(arr, brr);
	printf("%s\n", h);
}
